package com.dong.pointandviewpager.sample.activity

import android.os.Bundle
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.dong.pointandviewpager.R
import com.dong.pointandviewpager.sample.factory.DataFactory.newDataBeans
import com.dong.pointandviewpager.sample.factory.ListenerFactory.newChangedListener
import com.dong.pointandviewpager.sample.factory.ListenerFactory.newClickListener
import com.dong.pointandviewpager.sample.model.ModelBean
import com.dong.pointviewpager.widget.OverCardViewPager
import kotlinx.android.synthetic.main.activity_over_card.*

class OverCardActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_over_card)

        //配置OverCardViewPager参数
        val overCardViewPager = overCardViewPager as OverCardViewPager<ModelBean>
        overCardViewPager.run {
            setImageScale(ImageView.ScaleType.FIT_XY) //修改视图的填充类型
            setLoop(true) //设置是否循环(图片数量大于3有效)
            onLoopPagerClickListener = newClickListener() //设置选中监听，替代addOnPageChangeListener方法
            onLoopPagerClickListener = newClickListener() //设置点击监听
            beans = newDataBeans() //设置数据源
            setRadius(3f) //设置圆角弧度
            offset = 20f //设置重叠卡片的下移距离
            initialise() //参数配置完成后，执行适配(必须执行，且必须最后一步执行)
        }
    }
}